package exercise;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

/*
    输入某人生日，格式为"yyyy-MM-dd"，输出到现在为止经过了多少周。
 */
public class Test03 {
    public static void main(String[] args) throws ParseException {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        Date date = new Date();
        long l1 = date.getTime();
        String str1 = sdf.format(date);
        System.out.println("现在时间：" + str1);

        Scanner sc = new Scanner(System.in);
        System.out.print("出生日期：");
        String str2 = sc.next();
        Date d = sdf.parse(str2);
        long l2 = d.getTime();

        long day = (l1 - l2)/1000/60/60/24/7;
        System.out.println("到现在为止经过了" + day + "周");
    }
}
